import request from '@/utils/request'

// 查询秒杀活动列表
export function listSeckill (query) {
  return request({
    url: '/store/promotion/seckill_zone',
    method: 'get',
    params: query
  })
}
// 新增秒杀活动
export function addSeckill (data) {
  return request({
    url: '/store/promotion/seckill_zone',
    method: 'post',
    data: data
  })
}
// 修改秒杀活动
export function updateSeckill (id, data) {
  return request({
    url: '/store/promotion/seckill_zone/' + id,
    method: 'put',
    data: data
  })
}

// 获取秒杀活动详情
export function getSeckillInfo (id) {
  return request({
    url: '/store/promotion/seckill_zone/' + id,
    method: 'get',
  })
}

//    新增秒杀活动时间段 Paragraph
export function addSeckillTimeParagraph (seckillId, data) {
  return request({
    url: `/store/promotion/seckill_zone/${seckillId}/section`,
    method: 'post',
    data: data,
  })
}

//  修改秒杀活动时间段
export function updateSeckillTimeParagraph (seckillId, id, data) {
  return request({
    url: `/store/promotion/seckill_zone/${seckillId}/section/${id}`,
    method: 'put',
    data: data,
  })
}


//  获取秒杀活动时间段列表
export function getSeckillTimeParagraph (seckillId) {
  return request({
    url: `/store/promotion/seckill_zone/${seckillId}/sections`,
    method: 'get',
  })
}


//  删除秒杀活动时间段
export function delSeckillTimeParagraph (seckillId, id) {
  return request({
    url: `/store/promotion/seckill_zone/${seckillId}/section/${id}`,
    method: 'delete',
  })
}

// 关闭 活动 
export function closeActivity (id) {
  return request({
    url: `/store/promotion/seckill_zone/${id}/close`,
    method: 'delete',
  })
}


// 上传图片 
export function uploadPicture (data) {
  return request({
    url: `/oss/common/upload`,
    method: 'post',
    data: data
  })
}